package com.isoftstone.securityframework.device;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.isoftstone.securityframework.api.Permission;
import com.isoftstone.securityframework.device.domain.Device;
import com.isoftstone.securityframework.device.domain.DeviceGroup;

/**
 * 设备组管理接口
 * 
 * @author david
 * 
 */
public interface DeviceGroupManager {

	public DeviceGroup add(DeviceGroup group);

	public DeviceGroup modify(DeviceGroup group);

	public DeviceGroup remove(DeviceGroup group);

	public DeviceGroup remove(Integer id);

	public DeviceGroup get(Integer id);

	public DeviceGroup get(String groupName);

	public List<DeviceGroup> list();

	public List<DeviceGroup> list(Map<String, Object> params);

	/**
	 * 终端组关系维护
	 * 
	 * @param Device
	 * @param groups
	 */
	public void relDeviceGroup(Device Device, DeviceGroup[] groups);

	public void relDeviceGroup(Device Device, Serializable[] groupIds);

	public void relDeviceGroup(Serializable DeviceId, Serializable[] groupIds);

	public void unrelDeviceGroup(Device Device, DeviceGroup[] groups);

	public void unrelDeviceGroup(Device Device, Serializable[] groupIds);

	public void unrelDeviceGroup(Serializable DeviceId, Serializable[] groupIds);

	/**
	 * 设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void relDeviceGroupPermission(DeviceGroup tg, Permission[] permissions);

	/**
	 * 设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void relDeviceGroupPermission(DeviceGroup tg, Serializable[] permissions);

	/**
	 * 设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void relDeviceGroupPermission(Serializable deviceGroupId,
			Serializable[] permissionIds);
	/**
	 * 取消设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void unrelDeviceGroupPermission(DeviceGroup tg, Permission[] permissions);

	/**
	 * 取消设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void unrelDeviceGroupPermission(DeviceGroup tg, Serializable[] permissions);

	/**
	 * 取消设备组授权
	 * 
	 * @param tg
	 * @param permissions
	 */
	void unrelDeviceGroupPermission(Serializable deviceGroupId,
			Serializable[] permissionIds);


	/**
	 * 获取群组的权限
	 * @param group
	 * @return
	 */
	List<Permission> permissions(DeviceGroup group);

}
